home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Treccani Italiana Di Scienze Lettere Ed Arti
/
[Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso
/
mac
/
data
/
menu_dvd.swf
/
scripts
/
__Packages
/
CAlert.as
next >
Wrap
Text File
|
2007-11-07
|
5KB
|
155 lines
class CAlert extends mx.core.UIObject
{
var mAutoHide = true;
function CAlert()
{
super();
this.mOkCallback = null;
this.mYesCallback = null;
this.mNoCallback = null;
this.mCancelCallback = null;
this.mCssInitDone = false;
this.Init();
}
function SetCallback(inButtonId, inCallerObj, inFunctionName, inArgArray)
{
if(inButtonId.toLowerCase() == "ok")
{
this.mOkCallback = {callerObject:inCallerObj,functionName:inFunctionName,argArray:inArgArray};
}
else if(inButtonId.toLowerCase() == "yes")
{
this.mYesCallback = {callerObject:inCallerObj,functionName:inFunctionName,argArray:inArgArray};
}
else if(inButtonId.toLowerCase() == "no")
{
this.mNoCallback = {callerObject:inCallerObj,functionName:inFunctionName,argArray:inArgArray};
}
else if(inButtonId.toLowerCase() == "cancel")
{
this.mCancelCallback = {callerObject:inCallerObj,functionName:inFunctionName,argArray:inArgArray};
}
}
function Init()
{
this._x = (Stage.width - this.mc_dialog_bkg._width) / 2;
this._y = (Stage.height - this.mc_dialog_bkg._height) / 2;
var orgPoint = {x:0,y:0};
this.mc_grab_clip.globalToLocal(orgPoint);
this.mc_grab_clip._x = orgPoint.x;
this.mc_grab_clip._y = orgPoint.y;
this.mc_grab_clip._width = Stage.width;
this.mc_grab_clip._height = Stage.height;
this.mc_grab_clip.onPress = function()
{
};
this.mc_grab_clip.useHandCursor = false;
this.mc_grab_clip._alpha = 10;
this.txt_AlertTitle.html = true;
this.txt_AlertMessage.html = true;
this.txt_AlertTitle.wordWrap = true;
this.txt_AlertMessage.wordWrap = true;
this.txt_AlertTitle.embedFonts = _global.gUseEmbeddedFont;
this.txt_AlertMessage.embedFonts = _global.gUseEmbeddedFont;
this.Hide();
}
function InitCSS()
{
if(this.mCssInitDone == true)
{
return undefined;
}
this.mCssInitDone = true;
this.txt_AlertTitle.embedFonts = _global.gUseEmbeddedFont;
this.txt_AlertMessage.embedFonts = _global.gUseEmbeddedFont;
this.txt_AlertTitle.styleSheet = _global.gStyleManager.GetCSS();
this.txt_AlertMessage.styleSheet = _global.gStyleManager.GetCSS();
}
function ShowAlert(inTitle, inMessage, inFrameLabel, inBkgAlpha)
{
this.InitCSS();
var titoloDialog = inTitle;
if(titoloDialog.length == 0)
{
titoloDialog = CAlert.DEFAULT_TITLE;
}
this.txt_AlertTitle.htmlText = "<span class=\'alertTitle\'>" + titoloDialog + "</span>";
this.txt_AlertMessage.htmlText = "<span class=\'alertTesto\'>" + inMessage + "</span>";
this.mc_grab_clip._alpha = inBkgAlpha;
this._visible = true;
this.gotoAndStop(inFrameLabel.toLowerCase());
}
function ShowAlertByMsgId(inMsgId, inFrameLabel, inBkgAlpha)
{
if(!this.mMessage)
{
return undefined;
}
this.InitCSS();
var theMessage = this.mMessage.GetMessage(inMsgId);
if(!theMessage)
{
trace("ID MESSAGE NOT FOUND");
return undefined;
}
this.txt_AlertTitle.text = "<span class=\'alertTitle\'>" + theMessage.title + "</span>";
this.txt_AlertMessage.text = "<span class=\'alertTesto\'>" + theMessage.body + "</span>";
this.mc_grab_clip._alpha = inBkgAlpha;
this._visible = true;
this.gotoAndStop(inFrameLabel);
}
function Hide()
{
this._visible = false;
}
function YesBtnCallback()
{
if(this.mAutoHide == true)
{
this.Hide();
}
if(this.mYesCallback != null)
{
this.mYesCallback.callerObject[this.mYesCallback.functionName].apply(this.mYesCallback.callerObject,this.mYesCallback.argArray);
this.mYesCallback = null;
}
}
function NoBtnCallback()
{
if(this.mAutoHide == true)
{
this.Hide();
}
if(this.mNoCallback != null)
{
this.mNoCallback.callerObject[this.mNoCallback.functionName].apply(this.mNoCallback.callerObject,this.mNoCallback.argArray);
this.mNoCallback = null;
}
}
function CancelBtnCallback()
{
if(this.mAutoHide == true)
{
this.Hide();
}
if(this.mCancelCallback != null)
{
this.mCancelCallback.callerObject[this.mCancelCallback.functionName].apply(this.mCancelCallback.callerObject,this.mCancelCallback.argArray);
this.mCancelCallback = null;
}
}
function OkBtnCallback()
{
trace("OkBtnCallback");
if(this.mAutoHide == true)
{
this.Hide();
}
if(this.mOkCallback != null)
{
this.mOkCallback.callerObject[this.mOkCallback.functionName].apply(this.mOkCallback.callerObject,this.mOkCallback.argArray);
this.mOkCallback = null;
}
}
}